<template>
	<view class="wrap" style="padding-bottom: 60px;">
		<view class="search">
			<u-search v-model="queryParam.orderParams" @custom="orderList" @search="orderList"></u-search>
		</view>
		<view v-for="(item,index) in list" :key="item.id" >
			<u-card class="task-list-item" :border="false"  padding="20" margin="20rpx" @click="linkOk(item)">
				<view slot="head" style="display: flex;align-items: center;justify-content: space-between;">
					<view style="display: flex;align-items: center;font-size: 30rpx;">{{item.orderNumber}}</view><view style="color: #999999;font-size: 22rpx;">{{item.orderDate || ''}}</view>
				</view>
				<view class="" slot="body">
					<u-row gutter="16">
						<u-col span="12">
							<view class="apply-text"><span>项目号1：</span>{{item.projectNumber || ''}}</view>
							<view class="apply-text"><span>客户名称：</span>{{item.customerName || ''}}</view>
							<view class="apply-text"><span>地址：</span>{{item.address || ''}}</view>
							<view class="apply-text"><span>业主电话：</span>{{item.phone || ''}}</view>
							<view class="apply-text"><span>备注：</span>{{item.remark || ''}}</view>
							<view class="apply-text" style="margin-top: 20rpx;">
								<u-steps mode="number" :list="typeList" :current="item.orderStatus"></u-steps>
							</view>
							<view style="padding: 20rpx;"  v-for="(attach,index) in item.attachList" :key="index">
								<image class="user-images" :src="attach.replace(/\\/g,'/')"  @click="previewImage(item,attach)"></image>
							</view>
						</u-col>
						<!-- <u-col span="4"></u-col> -->
					</u-row>
				</view>
			</u-card>
		</view>
	</view>
	
</template>

<script>
import steps from '@/uview-ui/components/u-steps/u-steps.vue';
export default {
	components: {
	  steps
	},
	data() {
		return {
			current: 1,
			show: false,
			queryParam: {
				orderParams:''
			},
			list:[],
			active: 1,
			typeList: [{
					name: '待领料'
				}, {
					name: '已领料'
				}, {
					name: '生产中'
				}, {
					name: '生产完成'
				}, {
					name: '已派单'
				}, {
					name: '已发货'
				}, {
					name: '订单完成'
				},],
		}
	},
	created(){
		this.orderList();
	},
	methods: {
		navTo(url) {
			uni.navigateTo({
				url: url
			});
		},
		orderList(){
			this.$u.api.bizOrderList(this.queryParam).then(res => {
				console.log(res);
				this.list = res.data.list
			})
		},
		search(){
			this.orderList();
		},
		previewImage(item,url) {
		  uni.previewImage({
		    current: url,
		    urls: item.attachList,
		    indicator: true
		  });
		},
		linkOk(item){
			console.log(555);
				uni.$emit('linkBillOk',item)
				
				uni.navigateBack({
					delta: 1
				})
		}
	}
	
}
</script>

<style lang="scss" scoped>
@import 'index.scss';
page {
	background-color: #f5f5f5;
}
.wrap .search{
	background: #ffffff;
}
.apply-text{
	font-size: 28rpx;
	color: #333333;
	span{
		color: #999999;
	}
}
.user-images{
	width: 80px;
	height:80px;
	margin-right: 8px;
}
.apply-list-foot{
	font-size: 28rpx;
}
.personnel-list{
	display: flex;
	align-items: center;
	flex-wrap:wrap;
	.personnel-user{
		position: relative;
		margin: 5px 9px 0;
	}
	.user-images{
		width: 48px;
		height:48px;
		margin-right:0;
		
	}
	.iconfont{
		position: absolute;
		top:-12px;
		right:-5px;
		color: #FE0100;
	}
}
</style>